package Commandes;

import Composite.Element;
import projetjava.*;


public class Commande_Renommer implements Commande{
    
    private Element courant;
    private String nom;
    private String ancienNom;
    
    public Commande_Renommer(Element courant,String nom) {
        
        this.nom=nom;
        this.courant=courant;
    }
    
    public boolean executer() {
        
        this.ancienNom = new String(courant.toString());
        this.courant.setNom(nom);
        
        return true;
    }
    
    public boolean cancel() {

                 String temp = nom;
                 this.courant.setNom(this.ancienNom);              
                 this.nom = new String(nom);
                 this.ancienNom = temp;
            

           return true;
    }
    
}
